package string;

/*形参String,int fromIndex
 返回下标index*/
public class IndexOfDemo {
    public static void main(String[] args) {
        //            0123456789x12345
        String str = "thinking in java";
        int index = str.indexOf("in");
        System.out.println(index);
        index = str.indexOf("in", index + 1);
        System.out.println(index);
        index = str.indexOf("in", index + 1);
        System.out.println(index);
        index = str.lastIndexOf("in", index);
        System.out.println(index);
        index = str.lastIndexOf("wakaka");
        System.out.println(index);

    }
}


